package com.hoshiicloud.fileserver.service;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.fileserver.model.UploadFileResponse;

import java.io.InputStream;

/**
 * 文件对象操作服务接口类
 * @author Mr.wu
 *
 */
public interface FileObjectService {

	/**
	 * @param bucketName
	 * @param objectKey
	 * @return com.hoshiicloud.common.rpc.Response
	 * @author: Mr.wu
	 * @descripton: 下载文件
	 * @date: 17:40 2019/6/5
	 */
	public Response downloadFile(String bucketName,String objectKey) throws Exception;

	/**
	 * 上传一个文件对象
	 * @param bucketName
	 * @param folder
	 * @param objectKey
	 * @param fileStream
	 * @Param privateOwned 私有化 如果为true，对象读取权限为私有读写
	 * @return
	 * @throws Exception
	 */
	public Response<UploadFileResponse> uploadFile(String bucketName, String folder, String objectKey, InputStream fileStream, Boolean privateOwned) throws Exception;

	/**
	 * 上传一个文件对象 使用默认权限（公有）
	 * @param bucketName
	 * @param folder
	 * @param objectKey
	 * @param fileStream
	 * @return
	 * @throws Exception
	 */
	public Response<UploadFileResponse> uploadFile(String bucketName, String folder, String objectKey, InputStream fileStream) throws Exception;
	
	/**
	 * 删除一个文件对象
	 * @param bucketName
	 * @param objectKey
	 * @return
	 */
	public Response<String> deleteFile(String bucketName,String objectKey) throws Exception;

	Response<String> test();
}
